{% extends "../layout.html" %}

{% block content %}
<div class="dy-wrapper">
  <form action="{{ url }}" method="post" class="needs-validation" novalidate>
    <div class="row mb-3">
      <label for="name" class="col-sm-2 col-form-label text-end">名称</label>
      <div class="col-sm-10 position-relative">
        <input type="text" class="form-control" id="name" name="name" value="{{ data.name }}" placeholder="请输入名称" required />
        <div class="invalid-tooltip">名称必须填写</div>
      </div>
    </div>
    <div class="row mb-3">
      <label for="seo_title" class="col-sm-2 col-form-label text-end">SEO标题</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="seo_title" name="seo_title" value="{{ data.seo_title }}" placeholder="请输入SEO标题" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="seo_keywords" class="col-sm-2 col-form-label text-end">SEO关键字</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="seo_keywords" name="seo_keywords" value="{{ data.seo_keywords }}" placeholder="请输入SEO关键字" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="seo_description" class="col-sm-2 col-form-label text-end">SEO描述</label>
      <div class="col-sm-10">
        <textarea class="form-control" id="seo_description" name="seo_description" placeholder="请输入SEO描述">{{ data.seo_description }}</textarea>
      </div>
    </div>
    <div class="row mb-3">
      <label for="is_sale" class="col-sm-2 col-form-label text-end">是否在售</label>
      <div class="col-sm-10">
        <input type="radio" class="form-control" id="is_sale_0" name="is_sale" value="0" {% if data.is_sale == 0%} checked {% endif %} />否
        <input type="radio" class="form-control" id="is_sale_1" name="is_sale" value="1" {% if data.is_sale == 1%} checked {% endif %} />是
      </div>
    </div>
    <div class="row mb-3">
      <label for="price" class="col-sm-2 col-form-label text-end">价格</label>
      <div class="col-sm-10">
        <input type="number" min="0" class="form-control" id="price" name="price" value="{{ data.price }}" placeholder="请输入价格" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="sales" class="col-sm-2 col-form-label text-end">销量</label>
      <div class="col-sm-10">
        <input type="number" min="0" class="form-control" id="sales" name="sales" value="{{ data.sales }}" placeholder="请输入销量" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="hits" class="col-sm-2 col-form-label text-end">点击</label>
      <div class="col-sm-10">
        <input type="number" min="0" class="form-control" id="hits" name="hits" value="{{ data.hits }}" placeholder="请输入点击量" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="tid" class="col-sm-2 col-form-label text-end">分类</label>
      <div class="col-sm-10 position-relative">
        <select class="form-select" id="tid" name="tid" required>
          {% for item in taxons %}
          <option value="{{ item.id }}" {% if data.tid == item.id %}selected{% endif %}>{{ item.name }}</option>
          {% endfor %}
        </select>
        <div class="invalid-tooltip">分类必须选择</div>
    </div>
    <div class="row mb-3">
      <label for="url" class="col-sm-2 col-form-label text-end">销售地址</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="url" name="url" value="{{ data.url }}" placeholder="请输入销售地址" />
      </div>
    </div>
    <div class="row mb-3">
      <label for="image" class="col-sm-2 col-form-label text-end">图片</label>
      <div class="col-sm-10">
        <div class="upload_res" id="uploadRes"><input type="hidden" id="image" name="image" value="{{ data.image }}"/></div>
        <div class="upload-form">
          <div class="position-relative upload-action">
            <span class="fa fa-cloud-upload fs-3"></span>
            <input type="file" class="position-absolute form-control file_upload" id="upload" name="upload" />
          </div>
          <div class="mt-2 img">
            <div class="img show_img" id="showimg">
              {% if data.image != "" %}
              <img src="{{ data.image }}" alt="" height="100" />
              {% endif %}
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="row mb-3">
      <label for="content" class="col-sm-2 col-form-label text-end">详情</label>
      <div class="col-sm-10">
        <textarea class="form-control" id="tiny_content" name="content" placeholder="请输入详情">{{ data.content }}</textarea>
      </div>
    </div>
    
    <div class="row mb-3">
        <label class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <button type="submit" class="btn btn-sky-blue ">保存</button>
        </div>
    </div>
  </form>
</div>
{% endblock %}